//
//  CrushUnitSprite.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/7/8.
//
//

#include "BadStateUnitSprite.h"

USING_NS_CC;

#define TOTAL_UNIT (5)
#define MAX_COVER_HP  (5)

static const char *unitNormal[TOTAL_UNIT] = {
    "None",
    "SuckBloodUnit.png",
    "MonsterHand.png",
    "ProtectCoverUnit.png",
    "BlankUnit.png",
};

float BadStateUnitSprite::getContentWidth()
{
    static float itemWidth = 0;
    if (0 == itemWidth) {
        Sprite *sprite = CCSprite::createWithSpriteFrameName(unitNormal[0]);
        itemWidth = sprite->getContentSize().width;
    }
    return itemWidth;
}

BadStateUnitSprite::BadStateUnitSprite()
: m_col(0)
, m_row(0)
, m_type(0)
{
}

BadStateUnitSprite *BadStateUnitSprite::create(int row, int col, int type)
{
	BadStateUnitSprite *unit = new BadStateUnitSprite();
    unit->m_row = row;
    unit->m_col = col;
    unit->m_type = type;
    unit->initWithSpriteFrameName(unitNormal[unit->m_type]);
    unit->autorelease();
    return unit;
}


